package com.javabasic.algorithm.leetcode;

/**
 * @Author xiongmin
 * @Description //TODO
 * @Date 2020/2/8 22:35
 * @Version 1.0
 **/
public class NumberOf1Bits {
    public int hammingWeight(int n) {
        int len = 32;
        int result = 0;
        while (len-- > 0) {
            System.out.println(n);
            if ((n&1) == 1) {
                result++;
            }
            n >>>= 1;
        }
        return result;

    }
}
